<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="tag" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"  %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type"
	content="text/html; charset=windows-1251">

<link type="text/css" rel="stylesheet"
	href="<%=request.getContextPath()%>/resources/css/cupertino/jquery-ui-1.8.18.custom.css" />	
<script type="text/javascript" src="<%=request.getContextPath()%>/resources/javascripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/resources/javascripts/jquery-ui-1.8.18.custom.min.js"></script>


<script>
		
	var $dialog;
	var $currentId;
	
	$(function(){
		//$("#accordion").accordion();
	});
	
	$(document).ready(
			
		function() {
	    	
	    	$dialog = $('#dialog-message').dialog({
				modal: true,
				autoOpen: false,
				buttons: {
					Ok: function() {
						$( this ).dialog( "close" );
						window.location = "/FreeTimeTool/holidayrequest/delete/"+$currentId;
						return true;
					},
	    			Cancel: function() {
					$( this ).dialog( "close" );
					return false;
					}
	    	
				}
			}	
	    	
	    	);	

	  }
		
	);  
	
	function deleteDialog(id){
		$currentId = id;
		 $dialog.dialog('open');
		return false;
	}
	
	
	
	
	</script>
	
	<style type="text/css">
	#dialog_link {padding: .4em 1em .4em 20px;text-decoration: none;position: relative;}
	#dialog_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}
	
	</style>


</head>
<body >


<div class="details">
	<c:choose>
		<c:when test="${not empty holidayList}">
		
		<div id="accordion">
		<c:forEach var="holidayRequest" items="${holidayList}">
		
			
    <h3><a href="#">
    <tag:message code="holidayRequests.startDate" /> : 
    <fmt:formatDate type="date" value="${holidayRequest.holidaysStartDate}" pattern="dd-MM-yyyy"/>
     
    
    <tag:message code="holidayRequests.endDate" /> : 
    <fmt:formatDate type="date" value="${holidayRequest.holidaysEndDate}" pattern="dd-MM-yyyy"/>
    
    
    </a></h3>
    <div>
	<p style ="font-weight: bold;"><tag:message code="headers.holidayRequestsHeaderDetails" />:</p>
	<tag:message code="holidayRequests.startDate" /> 
	: <fmt:formatDate type="date" value="${holidayRequest.holidaysStartDate}" pattern="dd-MM-yyyy"/><br/>
	
	<tag:message code="holidayRequests.endDate" /> 
	: <fmt:formatDate type="date" value="${holidayRequest.holidaysEndDate}" pattern="dd-MM-yyyy" /><br/>
	
	<tag:message code="holidayRequests.kind" /> : ${holidayRequest.kind}<br/>
	<tag:message code="holidayRequests.id" /> : ${holidayRequest.id}<br/>
	
	<p style ="font-weight: bold;">
	<tag:message code="holidayRequests.status" />:
	<c:choose>
	<c:when test="${holidayRequest.status == true}">
	<tag:message code="holidayRequests.accepted" />
	</c:when>
	<c:otherwise>
	<tag:message code="holidayRequests.notAccepted" />
	</c:otherwise>
	</c:choose></p>
	
	
	<p><a href="/FreeTimeTool/holidayrequest/delete/${holidayRequest.id}"
	 id="dialog_link" class="ui-state-default ui-corner-all" onclick="return deleteDialog(${holidayRequest.id})"><span class="ui-icon ui-icon-trash"></span>delete</a></p>
	  
	</div>

		</c:forEach>
		</div>
		</c:when>
		<c:otherwise> Can't find holidayRequests </c:otherwise>
	</c:choose>	
	
</div>

<div style="visibility: hidden;">
		  <div id="dialog-message" title="Confirm dialog" >
	<p>
		<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>

		Na pewno chcesz usunac urlop?
	</p>
	
</div>
</div>

</body>
</html>